package com.flca.frw.validator
{
	import mx.validators.Validator;
	import mx.validators.ValidationResult;
	import mx.validators.StringValidator;
	
	public class EqualsValidator extends Validator
	{
		[Inspectable]
		public var compareWith : String;

		private var results:Array;

		public function EqualsValidator() {
			super();
		}

	    override protected function doValidation(value : Object):Array {
		    // Clear results Array.
		    results = [];
		
		    // Call base class doValidation().
		    results = super.doValidation(value);        
		    if (results.length > 0) {
		        return results;
		    }
		    
		    if (compareWith != value) {
		        results.push(
		        	new ValidationResult(true, null, "", "Is niet gelijk"));
		        return results;
		    }
		    
		    return results;
		}

	}
}